<?php
/*
Template Name: Catalog
*/ ?>

<?php get_header(); ?>

        <div class="recentProject row">
        	<div class="view row view--modifier">
			<?php 
            $args = array(
                'post_type' => 'catalog',
                );
            $col_num = 2;
			$test =0;
            $query = new WP_Query( $args); ?>
        
                <?php 
                if ( $query->have_posts() ):
                    while ( $query->have_posts() ) :
                        $query->the_post(); ?>
                  <div class="catalog_cover col-xs-12 col-sm-6 col-md-6 col-lg-6">
                    <div class="catalog_wrapImage col-xs-12 col-sm-6 col-md-6 col-lg-7">
                    <?php if (strtotime($post->post_date) > strtotime('-30 days')): ?> 
                    	<div class="catalog_new">New!</div> 
					<?php endif; ?>
                    
                    <?php if (has_post_thumbnail()) : ?>

                        <!-- BEGIN .entry-thumbnail -->
                            <?php the_post_thumbnail('post-thumb'); ?>
                        <!-- END .entry-thumbnail -->

					<?php endif; ?>
                     
                    </div><!-- End  catalog_wrapImage-->
                    <div class="catalog_wrapInfo col-xs-12 col-sm-6 col-md-6 col-lg-5">
                    	<h3><?php echo the_title(); ?></h3>
                        <?php   
							$post_id = get_the_ID();
							$hotel_brochure = get_post_meta( $post_id, 'wp_custom_attachment', true );
						?>
                        <div class="catalog_downloadBtn">
                         	<a href="<?php echo $hotel_brochure['url']?>" class="btn btn-primary fancybox-pdf">ดูออนไลน์</a>
                        </div><!-- End  catalog_downloadBtn-->
                        <div class="catalog_viewBtn">
                            <a href="<?php echo $hotel_brochure['url']?>" class="btn btn-primary">ดาวน์โหลด</a>
                        </div><!-- End  catalog_viewBtn-->
                    </div><!-- End  catalog_wrapInfo-->
                  </div><!-- End  catalog_cover-->
                  <?php endwhile; // end while
                endif; // end if
                ?>
              </div>
        </div><!-- End  recentProject-->        
   <?php get_footer(); ?>